<div class="pa clearfix">
  <div class="span-p70 colborder">
    <h3><%= @action_title %></h3>
    <hr/>
    <div>
      <table>
        <tr>
          <th width="30"><%= check_box_tag 'checkall' %></th>
          <th>Id</th>
          <th>用户</th>
          <th>订单明细</th>
          <th>金额</th>
          <th>类型</th>
          <th>状态</th>
          <th>操作</th>
        </tr>
        <% @deals.each do |deal| %>
          <tr>
            <td><%= check_box_tag 'deals', deal.id %></td>
            <td><%= deal.id %></td>
            <td><%= link_to deal.user.name, "/users/show/#{deal.user.id}", :target => '_blank' %></td>
            <td>
              <ul>
                <% deal.orders.each do |order| %>
                  <li><%= link_to order.product.name, "products/show/#{order.product.id}", :target => '_blank' %> - 单价：<%= order.product.price %>元 × <%= order.discount/10 %>（折扣） × <%= order.number %>份 </li>
                <% end %>
              </ul>
            </td>
            <td><%= deal.amount %> 元</td>
            <td><%= deal_kind deal.kind %></td>
            <td><%= deal_status deal.status %></td>
            <td>
              <% if !@next_status.nil? %>
                <%= link_to "更新为：#{deal_status @next_status}", "/deals/change_status/#{deal.id}.#{@next_status}", :class => 'tdn pa-3 f-border shadow2 radius5' %>
              <% end %>
            </td>
          </tr>
          <tr>
            <td colspan="5">地址：<%= deal.user.address %></td>
            <td colspan="2">电话：<%= deal.user.phone %></td>
            <td colspan="1">时间：<%= deal.created_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
          </tr>
        <% end %>
      </table>
      <div class="c666">
        <%= will_paginate @deals %>
      </div>
    </div>
  </div>
  <div class="span-5 last">
    <%= render 'layouts/admin/deals_sidebar' %>
  </div>
</div>